package controller

import (
	"context"
	"eag_arch_layout/internal/model"
	"eag_arch_layout/internal/model/VO"
)

// baseCtrl 基础 控制器
type baseCtrl struct {
	user *VO.CurUserInfo
}

// GetCurUser 获取当前用户信息
func (b *baseCtrl) GetCurUser(ctx context.Context) (bool, string) {
	d := ctx.Value(model.CUR_USER_KEY)
	if curUser, ok := d.(VO.CurUserInfo); ok {
		b.user = &curUser
		return true, ""
	} else {
		return false, "获取不到用户的信息，请重新登录"
	}
}
